package com.ecfront.dao.impl;

import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.ecfront.dao.ShopGoodsSortDAO;
import com.ecfront.pojo.ShopGoodsSort;


/**
 * @version 1.0
 * @author www.ecfrom.com
 */

public class ShopGoodsSortDAOImpl extends HibernateDaoSupport implements ShopGoodsSortDAO {

	protected void initDao() {}


	public void save(ShopGoodsSort transientInstance) {
		getHibernateTemplate().saveOrUpdate(transientInstance);
	}

	public void delete(ShopGoodsSort persistentInstance) {
		getHibernateTemplate().delete(persistentInstance);
	}

	public ShopGoodsSort findById(java.lang.Integer id) {
		ShopGoodsSort instance = (ShopGoodsSort) getHibernateTemplate()
					.get("com.ecfront.pojo.ShopGoodsSort", id);
		return instance;
	}


	public List findByExample(ShopGoodsSort instance) {
		List results = getHibernateTemplate().findByExample(instance);
		return results;
	}

	public List findByProperty(String propertyName, Object value) {
		String queryString = "from Shopgoodssort as model where model."
					+ propertyName + "= ?";
		return getHibernateTemplate().find(queryString, value);
	}


	public List findBySgsName(Object sgsName) {
		return findByProperty(SGS_NAME, sgsName);
	}

	public List findAll() {
		String queryString = "from ShopGoodsSort";
		return getHibernateTemplate().find(queryString);
	}

	public static ShopGoodsSortDAO getFromApplicationContext(
			ApplicationContext ctx) {
		return (ShopGoodsSortDAO) ctx.getBean("ShopgoodssortDAO");
	}
}